<!-- Phan khai bao bien cuc bo-->
<?php
// xac dinh label hien thi: trinh ky, duoc giai quyet, khong duoc giai quyet
$arr_result_label = onegate_get_label_of_result_type($_SESSION['recordtype'],$v_recordtype_filter);
$v_staff_id = $_SESSION['staff_id'];
$v_current_status = ($arr_single_record['C_CURRENT_STATUS']);
$v_detail_status = intval($arr_single_record['C_DETAIL_STATUS']);
$v_reason = _replace_bad_char(trim($arr_single_record['C_REASON']));
$v_handler_id = intval($arr_single_record['FK_HANDLER']);
$v_num = '';
$v_dem = -1;
/*
	Kiem tra xem co quyen cap nhat trang thai ket quan thu ly khong?
*/
$v_update_status = false;
if($v_staff_id == $v_handler_id){
	$v_update_status = true;
}

if(isset($_REQUEST['fuseaction_back'])) {
	$fuseaction_back=$_REQUEST['fuseaction_back'];
}else{
	$fuseaction_back = "";
}
$v_display = "none";
if ($v_count_worktype > 0){
	$v_display = "block";
}
$v_work_date = date("d/m/Y");
$v_file_url = trim(CONST_URL_PATH_FROM_ROOT) . $v_file_name;
$v_goto_url = "javascript:filename_onclick('T_ONEGATE_RECORD_WORK', 'PK_RECORD_WORK', 'C_FILE_NAME', 'C_FILE_CONTENT'," . strval($v_record_work_id) . ",'" . $v_file_url ."');" ;
?>
<!--bang chua tieu de cua form-->
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="large_title">
		<td><?php echo CONST_UPDATE_STATUS_RECORD_TITLE; ?></td>
	</tr>
</table>
<!-- Bat cac phim: F12=true; Insert=false; Delete=false, ESC=true; Enter=true -->
<div id="hotkey" onKeyDown="javascript:process_hot_key(true,false,false,true,true);">
<!--bang chua cac text box de nhap du lieu-->
<table width="100%" class="form_table1" border="0">
	<col width="20%"><col width="80%">
	<tr>
		<form action="index.php" method="post" name="f" enctype= "multipart/form-data">
		<input type="hidden" name="fuseaction" value="" >
		<input type="hidden" name="fuseaction_back" value="<?php echo $fuseaction_back; ?>">
		<input type="hidden" name="hdn_record_id_list" value="<?php echo $v_record_id; ?>" >
		<input type="hidden" name="hdn_record_id" value="<?php echo $v_record_id; ?>" >
		<input type="hidden" name="hdn_recordtype_filter" value="<?php echo $v_recordtype_filter;?>">
		<input type="hidden" name="hdn_work" value="">
		<input type="hidden" name="hdn_handler_id" value="<?php echo $v_handler_id; ?>">
		<input type="hidden" name="hdn_reason" value="<?php echo $v_reason; ?>">
		<input type="hidden" name="hdn_question" value="OK">
	</tr>
	<tr>
		<td colspan="10"><?php echo onegate_show_record_general_info($arr_single_record,$_SESSION['recordtype'],true,$p_petition_link,$p_rate_of_progress_link,$p_document_link,$p_idea_link,$p_sign_link,$p_approve_link,$p_licensing_link,$v_url_view_update_record_status); ?></td>
	</tr>
	<tr>
		<td colspan="6" ><hr color="#66CCFF" size="1"></td>
	</tr>
	<tr>
		<td class="normal_label"><?php echo _CONST_WORK_DATE_LABEL?></td>
		<td>
			<input class="normal_date_textbox" name="txt_work_date" type="text" value="<?php echo $v_work_date; ?>" optional="true" isdate="true" message="<?php echo _CONST_WORK_DATE_MESSAGE;?>" onKeyDown="change_focus(document.forms(0),this)">
			<img src="<?php echo $_ISA_IMAGE_URL_PATH;?>calendar.gif" border="0" onclick="DoCal('<?php echo $_ISA_LIB_URL_PATH;?>isa-calendar/',document.forms(0).txt_work_date);" style="cursor:hand">
		</td>
	</tr><?php
	if (onegate_is_tranfer_to_senior_for_recordtype($v_staff_id,$v_recordtype_filter,$_SESSION["recordtype"]) 
		&& onegate_is_handler_for_recordtype($v_staff_id,$v_recordtype_filter,$_SESSION["recordtype"]) && $v_detail_status != 70){?>
		<tr class="normal_label">
			<td height="37"></td>
			<td><input type="radio" name="rad_status" value="CHUYEN_HOSO_CQTQ" onclick="refuse_onclick(this,document.forms(0).hdn_work);" optional="true"><?php echo $arr_result_label[7];$v_dem++;?></td>
		</tr><?php		
	}
	// Neu ho so do dang chuyen co quan co tham quyen giai quyet thi an option "Trinh lanh dao phong"
	if($v_detail_status != 70){
		if (onegate_is_submit_to_leader_for_recordtype($v_staff_id,$v_recordtype_filter,$_SESSION["recordtype"])
			&& onegate_is_handler_for_recordtype($v_staff_id,$v_recordtype_filter,$_SESSION["recordtype"])){
				if(!onegate_is_compare_leader($v_recordtype_filter,$_SESSION['recordtype'])){?>
					<tr class="normal_label">
						<td height="37"></td>		
						<td><input type="radio" name="rad_status" value="TRINH_LD_PHONG" onclick="refuse_onclick(this,document.forms(0).hdn_work);" optional="true"><?php echo $arr_result_label[0];$v_dem++;?></td>
					</tr>
			<?php }else{ ?>
					<tr class="normal_label">
						<td height="37"></td>		
						<td><input type="radio" name="rad_status" value="TRINH_LD_PHONG_LAN_DAU" onclick="refuse_onclick(this,document.forms(0).hdn_work);" optional="true"><?php echo $arr_result_label[0]; $v_dem++;?></td>
					</tr>			
			<?php }
		}
	}// != 70	
	?>
	<tr class="normal_label">
		<td class="normal_label"><?php echo CONST_RESULT_HANDLE_RECORD_LABEL; ?></td>
		<td><input type="radio" name="rad_status" value="LD_PHONG_CAPPHEP" onclick="refuse_onclick(this,document.forms(0).hdn_work);" optional="true"><?php echo $arr_result_label[1];$v_dem++; ?></td>
	</tr>
	<tr class="normal_label">
		<td height="37"></td>
		<td><input type="radio" name="rad_status" value="LD_PHONG_TUCHOI" onclick="refuse_onclick(this,document.forms(0).hdn_work);set_value_for_obj(document.forms(0).txt_reason,'<?php echo $v_reason;?>')" optional="true"><?php echo $arr_result_label[2]; $v_dem++; if($v_num!='') $v_num = $v_num.','.$v_dem; else $v_num = $v_dem;?></td>
	</tr>
	<tr id="tr_reason" class="normal_label" style="display:none">
		<td height="37"><?php echo CONST_RECORD_REASON_LABEL; ?></td>
		<td><textarea name="txt_reason" class="normal_textarea" value="<?php echo $v_reason;?>" row="4" style="width:100%" optional="true" message=""><?php echo $v_reason;?></textarea></td>
	</tr>
</table>
<!--bang chua cac button-->
<table width="100%" cellpadding="0" cellspacing="0">
	<tr height="5px">
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td align="center"><?php	
			if (($v_is_granted_update)||onegate_is_handler_for_recordtype($v_staff_id,$v_recordtype_filter,$_SESSION["recordtype"])){
				if($v_update_status){?>
					<input type="button" name="btn_save"  class="normal_button" value="<?php echo _CONST_SAVE_BUTTON;?>" onClick="if(test_status_update(document.forms(0).rad_status,document.forms(0).txt_reason,'<?=$v_num?>')){Update_record_status('UPDATE_RECORD_STATUS');}" onKeyDown="change_focus(document.forms(0),this)"><?php
				}
			}?>
				<input type="button" name="btn_back" class="normal_button" value="<?php echo _CONST_BACK_BUTTON;?>" onClick="btn_back_onclick('<?php echo $_GO_BACK?>')" onKeyDown="change_focus(document.forms(0),this)">	
		</td>
	</tr>
</table>					
</div>
</form>
<script language="JavaScript">
	set_focus(document.forms(0));
</script>
